-
Notifications
You must be signed in to change notification settings - Fork 6
refactor: add typescript [ECO-1017] #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -75,14 +86,14 @@ export default { | |||
referenceFieldPath: `navigation_menu.page_reference`, | |||
jsonRtePath: ['notification_bar.announcement_text'] | |||
}); | |||
let responsePages = await Stack.getEntries({ | |||
let responsePages: [PageResponse] = await Stack.getEntries({ | |||
contentTypeUid: 'page' | |||
}); | |||
let navHeaderList = response[0].navigation_menu; | |||
if (responsePages.length !== response.length) { | |||
responsePages.forEach(entry => { | |||
const hFound = response[0].navigation_menu.find( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use navHeaderList
variable
src/views/BlogContent.vue
Outdated
<script lang="ts"> | ||
|
||
interface List { | ||
author: []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type can be Array<any>
@@ -74,13 +89,13 @@ export default { | |||
}, | |||
methods: { | |||
async getData() { | |||
const archived = []; | |||
const recentPost = []; | |||
const archived = [] as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as Array<any>
@@ -97,11 +112,10 @@ export default { | |||
this.archivedList = archived; | |||
this.$store.dispatch('setPage', data[0]); | |||
this.$store.dispatch('setBlogpost', list); | |||
document.title = this.banner.title; | |||
const element = document.getElementsByClassName('cslp-tooltip'); | |||
const element: any = document.getElementsByClassName('cslp-tooltip'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if you can use this$refs
to access DOM elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use models instead of interfaces wherever applicable @karantalapalli
interface Buckets{ | ||
title_h3: string; | ||
description: string; | ||
} | ||
|
||
interface Data{ | ||
title_h2: string; | ||
bucket: Buckets; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For individual components have a common file from were you export interface using models
reference: https://dev.to/jwp/typescript-models-and-javascript-objects-31b3
src/components/BlogSection.vue
Outdated
interface Article { | ||
href: string; | ||
title: string; | ||
} | ||
|
||
interface Blogs { | ||
featured_image: Image; | ||
url: string; | ||
} | ||
|
||
interface Data { | ||
title_h2: string; | ||
view_articles: Article; | ||
featured_blogs: Blogs; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For individual components have a common file from were you export interface using models.
interface Header { | ||
local: string; | ||
logo: string; | ||
navigation_menu: []; | ||
notification_bar: string; | ||
title: string; | ||
} | ||
|
||
interface Footer { | ||
local: string; | ||
logo: string; | ||
copyright: string; | ||
navigation: []; | ||
social: string; | ||
title: string; | ||
} | ||
|
||
interface Response { | ||
page?: string; | ||
blog_post?: string; | ||
headers: Header; | ||
footer: Footer; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use models as required
src/components/FooterContent.vue
Outdated
interface PageResponse { | ||
title: string; | ||
url: string; | ||
} | ||
|
||
interface Links { | ||
title: string; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use models
refactor: add typescript [ECO-1017]